package IPrototipo.Funcionalidades.ABMCompetencia;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Image;
import java.util.Vector;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import IPrototipo.Funcionalidades.Menues.FrameUsuarioAutenticado;
import IPrototipo.Funcionalidades.Menues.iDialogGeneral;
import java.awt.Component;
import javax.swing.Box;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
import javax.swing.ImageIcon;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import java.awt.Color;

public class abmParticipante extends iDialogGeneral {


	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private JTextField txtNombreParticipante;
	private JTextField txtCorreoElectronico;

	public static void main(String[] args) {
		try {
			abmParticipante dialog = new abmParticipante(null,true);
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public abmParticipante(FrameUsuarioAutenticado pantallaPrincipal,boolean b) {
		super(pantallaPrincipal,b);
		label= new Dimension(150, 30);

		
		Dimension tam= new Dimension(400, 450);
		setTamanio(tam);
		setObligatorios(new Vector<Object>());
	
		getContentPane().setLayout(new BorderLayout());
		{
			JPanel panelTitulo = new JPanel();
			getContentPane().add(panelTitulo, BorderLayout.NORTH);
			{
				JLabel lblTitulo = new JLabel("Crear Participante"); 
				lblTitulo.setFont(new Font("Vani", Font.PLAIN, 20));
				panelTitulo.add(lblTitulo);
			}
		}

		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
		{
			JPanel pnlNombre = new JPanel();
			FlowLayout flowLayout = (FlowLayout) pnlNombre.getLayout();
			contentPanel.add(pnlNombre);
			pnlNombre.setMaximumSize(panel);
			{
				JLabel lblNombreDelParticipante = new JLabel("Nombre del Participante: ");
				lblNombreDelParticipante.setHorizontalAlignment(SwingConstants.LEFT);
				pnlNombre.add(lblNombreDelParticipante);
				lblNombreDelParticipante.setPreferredSize(label);
				
			}
			{
				txtNombreParticipante = new JTextField();
				pnlNombre.add(txtNombreParticipante);
				txtNombreParticipante.setPreferredSize(datos);
			}
		}
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
		{
			JPanel pnlContacto = new JPanel();
			FlowLayout flowLayout = (FlowLayout) pnlContacto.getLayout();
			contentPanel.add(pnlContacto);
			pnlContacto.setMaximumSize(panel);
			{
				JLabel lblCorreoElectronico = new JLabel("Correo Electronico:");
				lblCorreoElectronico.setHorizontalAlignment(SwingConstants.LEFT);
				pnlContacto.add(lblCorreoElectronico);
				lblCorreoElectronico.setPreferredSize(label);
				
			}
			{
				txtNombreParticipante = new JTextField();
				pnlContacto.add(txtNombreParticipante);
				txtNombreParticipante.setPreferredSize(datos);
			}
		}
		{
			Component verticalStrut = Box.createVerticalStrut(20);
			contentPanel.add(verticalStrut);
		}
		{
			JPanel pnlImagen = new JPanel();
			contentPanel.add(pnlImagen);
			{
				JPanel pnlimage = new JPanel();
				pnlimage.setBorder(new TitledBorder(null, "Imagen (Opcional) ", TitledBorder.LEADING, TitledBorder.TOP, null, null));
				pnlImagen.add(pnlimage);
				pnlimage.setPreferredSize(new Dimension(300,200));
				{
					JPanel panel = new JPanel();
					FlowLayout flowLayout = (FlowLayout) panel.getLayout();
					flowLayout.setHgap(8);
					flowLayout.setVgap(15);
					flowLayout.setAlignment(FlowLayout.LEFT);
					pnlimage.add(panel);
					{
						ImageIcon icon = new ImageIcon(abmParticipante.class.getResource("/Imagenes/participante.png"));
						Image img = icon.getImage();
						Image newimg = img.getScaledInstance(128, 128,  java.awt.Image.SCALE_SMOOTH);
						ImageIcon newIcon = new ImageIcon(newimg);
						
						JLabel label = new JLabel("");
						label.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
						panel.add(label);
						label.setIcon(newIcon);
						label.setToolTipText("Imagen del Participante");
					}
				}
				{
					JButton btnSeleccionar = new JButton("Seleccionar");
					pnlimage.add(btnSeleccionar);
				}
			}
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setMaximumSize(panel);
			buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("Aceptar");
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
			}
			{
				Component horizontalStrut = Box.createHorizontalStrut(20);
				buttonPane.add(horizontalStrut);
			}
			{
				JButton cancelButton = new JButton("Cancelar");
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
	}

}
